package com.yjy.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class Test36Controller {

    @Value("${spring.profiles.active}")
    private String profileActive;

    @RequestMapping("/testRequest")
    public Object testRequest() throws InterruptedException {
        log.info("{} testRequest", profileActive);
        return profileActive + " testRequest";
    }

    @RequestMapping("/testSleep30s")
    public Object testSleep30s() throws InterruptedException {
        log.info("{} testSleep30s start...", profileActive);
        Thread.sleep(1000*30);
        log.info("{} testSleep30s end...", profileActive);
        return profileActive + " sleep 30s";
    }

    @RequestMapping("/testSleep1m")
    public Object testSleep1m() throws InterruptedException {
        log.info("{} testSleep1m start...", profileActive);
        Thread.sleep(1000*60);
        log.info("{} testSleep1m end...", profileActive);
        return profileActive + " sleep 1m";
    }
}
